package com.haiyou.dc.base;

public class TestBlock {

    public void test1() {
        {
            System.out.println("4、普通代码块....");
        }
    }

    {
        System.out.println("2、构造块，比构造函数调用先...");
    }

    public TestBlock() {
        System.out.println("3、构造块...");
    }

    static {
        System.out.println("1、静态代码块...");
    }

    public void test2() {
        synchronized (this) {
            System.out.println("同步块...");
        }
    }

    public static void main(String[] args) {
        TestBlock testBlock = new TestBlock();
        testBlock.test1();
        testBlock.test2();
    }

}
